package com.zlzxm.sorting.ui.activity

import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.viewbinding.ViewBinding
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.listener.OnItemClickListener
import com.zlzxm.sorting.databinding.AcSortingByMerchantBinding
import com.zlzxm.sorting.globe.picOne
import com.zlzxm.sorting.globe.startPage
import com.zlzxm.sorting.ui.adapter.AdapterSortingMerchant
import com.zlzxm.sorting.ui.adapter.entity.EntityMerchant
import com.zlzxm.sorting.util.ui.manager.AbsAcBase

class AcSortingByMerchant : AbsAcBase(), OnItemClickListener {

    val binding by lazy {

        AcSortingByMerchantBinding.inflate(layoutInflater)

    }

    val adapter  = AdapterSortingMerchant()

    override fun initBinding(): ViewBinding? {
        return binding
    }

    override fun initViewModel() {
    }

    override fun initView() {

//        fullScreenMode()

        binding.rv.layoutManager = GridLayoutManager(this,3)
        binding.rv.adapter = adapter

        adapter.setOnItemClickListener(this)

    }

    override fun initData() {

        val list = mutableListOf<EntityMerchant>()

        for (i in 0..10){

            list.add(EntityMerchant(picOne,"$i",i,10))

        }

        adapter.setNewInstance(list)

    }

    override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {

        startPage(AcCaozuo::class.java)
    }
}